package com.ztom.test.service

import com.ztom.beans.factory.BeanFactory
import com.ztom.beans.factory.support.aware.BeanFactoryAware
import com.ztom.context.ApplicationContext
import com.ztom.context.support.aware.ApplicationContextAware

/**
 * 不加 open 的话默认是个 final class
 *
 * @author ZhangTao
 */
open class TestService : BeanFactoryAware, ApplicationContextAware {

    private var beanFactory: BeanFactory? = null

    private var applicationContext: ApplicationContext? = null

    fun doTest() {
        println("TestService doTest...")
    }

    override fun setBeanFactory(beanFactory: BeanFactory) {
        this.beanFactory = beanFactory
    }

    override fun setApplicationContext(applicationContext: ApplicationContext) {
        this.applicationContext = applicationContext
    }

    override fun toString(): String {
        return "TestService={beanFactory=$beanFactory, applicationContext=$applicationContext}"
    }
}